
/**
 * concretefilters.h
 * 
 * This file declares all concrete filter classes
 * 
 * Copyright (c) 2008 Harunobu Oyama <nobukichi at gmail.com>
 * Licensed under GNU GPL version 3
 *
 */

#ifndef		CONCRETE_FILTERS_INCLUDED
#define		CONCRETE_FILTERS_INCLUDED

#include	<set>
#include	<QString>
#include	"filter.h"

class Tweet;


//! this filter does nothing, i.e. it shows everything
class ShowAllFilter : public Filter
{
public:
	//! provide a static instance, as it is used as the default filter
	static ShowAllFilter* getInstance();

	explicit ShowAllFilter(const QString& name);
	virtual bool test(const Tweet& tweet);
};


//! this filter shows the latest update of each user
class LatestUpdateFilter : public Filter
{
public:
	explicit LatestUpdateFilter(const QString& name);
	virtual void init();
	virtual bool test(const Tweet& tweet);
	
private:
	std::set<QString> passedUsers;
};


//! this filter shows tweets that has the specified @user
class AtUserFilter : public Filter
{
public:
	AtUserFilter(const QString& name, const QString& atUser);
	virtual bool test(const Tweet& tweet);

private:
	QString atUserName;
};


//! this filter shows tweets created by the specified user
class UserFilter : public Filter
{
public:
	UserFilter(const QString& name, const QString& user);
	virtual bool test(const Tweet& tweet);
	
private:
	QString userName;
};


//! this filter shows tweets created within the last specified seconds
class WhenFilter : public Filter
{
public:
	WhenFilter(const QString& name, int secs);
	virtual bool test(const Tweet& tweet);
	
private:
	int seconds;
};


#endif	//	CONCRETE_FILTERS_INCLUDED

